// Models for route parameters and results
class DaylightSavingParams {
  final String initialDate;
  final List<String> initialWeeks;

  DaylightSavingParams({
    this.initialDate = '2024-07-22',
    this.initialWeeks = const ['周一', '周二', '周三', '周四', '周五'],
  });

  // Convert to Map for route arguments
  Map<String, dynamic> toMap() {
    return {'initialDate': initialDate, 'initialWeeks': initialWeeks};
  }

  // Create from Map for route arguments
  static DaylightSavingParams fromMap(Map<String, dynamic>? map) {
    if (map == null) return DaylightSavingParams();

    return DaylightSavingParams(
      initialDate: map['initialDate'] as String? ?? '2024-07-22',
      initialWeeks:
          (map['initialWeeks'] as List<dynamic>?)?.cast<String>() ??
          ['周一', '周二', '周三', '周四', '周五'],
    );
  }
}

class DaylightSavingResult {
  final String selectedDate;
  final List<String> selectedWeeks;
  final String startTime;
  final String endTime;

  DaylightSavingResult({
    required this.selectedDate,
    required this.selectedWeeks,
    required this.startTime,
    required this.endTime,
  });

  // Convert to Map for route results
  Map<String, dynamic> toMap() {
    return {
      'selectedDate': selectedDate,
      'selectedWeeks': selectedWeeks,
      'startTime': startTime,
      'endTime': endTime,
    };
  }

  // Create from Map for route results
  static DaylightSavingResult fromMap(Map<String, dynamic> map) {
    return DaylightSavingResult(
      selectedDate: map['selectedDate'] as String,
      selectedWeeks: (map['selectedWeeks'] as List<dynamic>).cast<String>(),
      startTime: map['startTime'] as String,
      endTime: map['endTime'] as String,
    );
  }
}
